/** Author: David Powell
This file produces Figure A3
**/

clear all
set more off
set mat 800
set seed 8721

global dir "/jules/b/dpowell"
global DATA "${dir}/purdue/replication/DATA"
global OUTPUT "${dir}/purdue/replication/output"



use ${DATA}/finaldata


gen dep_oxycontin=1000*oxycontin_SDUD/medicaidb
gen dep_oxycodone=1000*oxycodone_SDUD/medicaidb

**annualize
for var dep*: replace X=X*4/numobs 



gcollapse dep_oxycontin  [aw=totpop], by(nontripl  year) fast
# delimit ;
twoway (connected dep_oxycontin year if nontripl==0 & year<=2005 &year>1995 , lwidth(thick)  msize(vtiny) lpattern(dash) color(blue) sort yaxis(1)) (connected dep_oxycontin year if nontripl==1 & year<=2005 & year>1995, color(red) lwidth(thick)  msize(vtiny) sort yaxis(1))
, graphregion(color(white)) ylabel(,nogrid) xlabel(1996(1)2005, angle(45)) legend(label(2 "Non-Triplicate States") label(1 "Triplicate States") rows(2) order(2 1)) xtitle("Year") ytitle("OxyContin Prescriptions per 1,000 Benes" ,  axis(1)) ;
gr export ${OUTPUT}/figA3.eps, replace;



